<template>
    <div>
   <header>歌手</header>
   <section class="sl_table">
       <ul>
           <li>港台</li>
           <li>内地</li>
           <li>日韩</li>
           <li>欧美</li>
       </ul>
       <div class="icon">
           <img src="@/assets/imgs/icon_all.png" alt="">
           全部</div>
   </section>
   <section class="song_list">
<div class="header">
    <span>精选歌手</span>
    <div class="right">
       <p>推荐</p>
       <p>最新</p>
    </div>
    <ul>
        <li v-for='singer of singers' :key='singer.id'>
            <img :src="singer.imgUrl" alt="">
            <p>{{singer.name}}</p>
            <h5>{{singer.detail}}</h5>
        </li>
        
    </ul>
</div>

   </section>
    </div>
</template>

<script>
import axios from 'axios';
// if (location.hash === '#/singers') {  // 当在本页面 刷新的时候 先清除缓存
//         sessionStorage.removeItem('cacheSingers');
//     }
export default {
    data(){
        return{
            singers:[]
        }
    },
    mounted() {
        // let cacheSingers=sessionStorage.getItem('cacheSingers');
        // if(!cacheSingers){
        //     cacheSingers=[];
        // }else{
        //     cacheSingers=JSON.parse(cacheSingers)
        // }

        // if(cacheSingers.length>0){
        //     this.singers=cacheSingers;
        // }else{
           
        // }
         axios.get('/music/getSinger').then(result=>{
                // console.log(result)
               this.singers=result.data.data.singers;
                console.log(this.singers)
            })
    },
}
</script>
<style lang="scss" scoped>
header{
    width: 100%;
    height: 1rem;
    position: relative;
    line-height: 1rem;
    color: #333;
    font-size: .38rem;
    text-align: center;
    overflow: hidden;
}

.sl_table{
    margin-bottom: .5rem;
    ul{
        width: 100%;
        display: flex;
        justify-content: space-around;
        margin-bottom: .3rem;
        li{
            width: 20%;
            height: .56rem;
            text-align: center;
            border-radius: .28rem;
            background-color: #EAEAEA;
            font-size: .28rem;
            color: #2A2A2A;
            line-height: .56rem;
        }
    }
    .icon{
        width: 7.1rem;
        height: 0.6rem;
        text-align: center;
        line-height: .6rem;
        border-radius: .3rem;
        background-color: #EAEAEA;
        font-size: .28rem;
        color: #2A2A2A;
        display: block;
        margin: 0 auto;
      img{
          width: 0.24rem;
          height: 0.28rem;
          margin-bottom: .1rem;
      }
    }
}
.song_list{
    width: 100%;
    .header{
        width: 100%;
        span{
            width: 3.75rem;
            display: block;
            padding-left:.3rem; 
            font-size: .32rem;
            color: #2A2A2A;
            line-height: .5rem;
            float: left;
        }
        .right{
            width: 3.75rem;
            float: right;
            height: .5rem;
            text-align: right;
            p{
               width: 1rem;
               height: 0.48rem;
               line-height: .48rem;
               display: inline-block;
              font-size: .24rem;
              color: #CD3869;
              text-align: center;
              position: relative;
              z-index: 2; 
              font-size: .28rem;
            }
        }
        ul{
            width: 100%;
            display: flex;
           justify-content: space-between;
           flex-flow: row wrap;
           margin-bottom: 1rem;
           li{
               width: 50%;
               text-align: center;
               margin-bottom: .1rem;
               img{
                   width: 3.64rem;
                   width: 3.64rem;
               }
                p{
                   text-align: left;
                   text-align: justify;
                   font-size: .28rem;
                   color: #333;
                   word-wrap: break-word;
                   word-break: break-all;
               }
               h5{
                   font-weight: normal;
                   text-align: left;
                   font-size: .24rem;
                   color: #888;
                   width: 3.64rem;
                   white-space: nowrap;
                   overflow: hidden;
                   text-overflow: ellipsis;
               }
           }
        }
    }

}
</style>
